package cn.yto.print.plugins;

import cn.yto.print.constants.AssistantConstants;
import cn.yto.print.enums.PluginRegistryEnum;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PluginStatusManager {

    private static final PluginStatusManager INSTANCE = new PluginStatusManager();
    private final Map<String, Integer> statusMap = new ConcurrentHashMap<>();

    private PluginStatusManager() {
        statusMap.put(PluginRegistryEnum.CN.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.DY.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.WPH.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.PDD.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.DW.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.JD.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.XHSX.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.KS.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.WXSPH.getCode(), AssistantConstants.CLOSED);
        statusMap.put(PluginRegistryEnum.AKC.getCode(), AssistantConstants.CLOSED);
    }

    public static PluginStatusManager getInstance() {
        return INSTANCE;
    }

    public void updatePluginStatus(String code, Integer connected) {
        statusMap.put(code, connected);
    }

    public Map<String, Integer> getPluginStatus() {
        return statusMap;
    }

}
